         <!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>派车申请书</title>
    <link rel="stylesheet" href="/layui/css/layui.css"  media="all">
    <script type="text/javascript" src="/layui/jquery-3.5.1.min.js"></script>
    <script src="/layui/layui.js" charset="utf-8"></script>
    <script th:inline="javascript">
        layui.use(['layer' ,'form', 'layedit', 'laydate', 'jquery'], function(){
            var form = layui.form
                ,layer = layui.layer
                ,laydate = layui.laydate
                ,$ = layui.jquery;
            //日期
            laydate.render({
                elem: '#begin-time'
                ,type: 'datetime',
                min: getNowFormatDate()
            });
            laydate.render({
                elem: '#end-time'
                ,type: 'datetime'
                ,min: getNowFormatDate()
            });
            //监听提交
            form.on('submit(demo1)', function(data){
                $.ajax({
                    url:'/management/submitCarApplication',
                    data:data.field,
                    success:function(){
                        layer.msg('提交成功');
                        window.location = '/management/applicationsCanBookCar';
                    },
                })
                return false;
            });
         });
        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            var currentdate = date.getFullYear() + seperator1 + month
                + seperator1 + strDate + " " + date.getHours() + seperator2
                + date.getMinutes() + seperator2 + date.getSeconds();
            return currentdate;
        }
    </script>
</head>
<body>
<button class="layui-btn layui-btn-sm" style="position: fixed" onClick="javascript :history.back(-1);">返回</button>
<div style="margin: auto; width: 1000px"><br><br>
    <h1>派车申请</h1>
    <form class="layui-form" action="" method="post">
        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend>基本信息</legend>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">申请人</label>
                    <div class="layui-input-inline">
                        <input lay-verify="required" type="text" readonly="readonly" autocomplete="off" class="layui-input" th:value="${session.user.name}">
                        <input type="hidden" th:value="${session.user.id}" name="staff.id" id="applicating_staff">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">项目类型</label>
                    <!--暂时是写死的，因为只有出差类型-->
                    <div class="layui-input-inline">
                        <input lay-verify="required" type="text" readonly="readonly" autocomplete="off" class="layui-input" th:value="出差项目">
                        <input type="hidden" th:value="1" name="applicationType">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">项目名称</label>
                    <div class="layui-input-inline">
                        <input lay-verify="required" type="text" readonly="readonly" autocomplete="off" class="layui-input" th:value="|${applicationBasicInfo.numbering}/${applicationBasicInfo.staff.name}/${applicationBasicInfo.supplier.name}|">
                        <input type="hidden" th:value="${applicationBasicInfo.id}" name="applicationId">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">人数</label>
                    <div class="layui-input-inline">
                        <input th:value="${applicationBasicInfo.travelPeoples.size()}" id="peopleNumber" name="passengerNumber" lay-verify="required" type="text" readonly="readonly" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">开始时间</label>
                    <div class="layui-input-inline">
                        <input  type="text"autocomplete="off" name="startTime" id="begin-time" class="layui-input" lay-verify="required" placeholder="yyyy-MM-dd HH:mm:ss">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">结束时间</label>
                    <div class="layui-input-inline">
                        <input type="text"autocomplete="off" name="endTime" id="end-time" class="layui-input" lay-verify="required" placeholder="yyyy-MM-dd HH:mm:ss">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">出发地</label>
                    <div class="layui-input-inline">
                        <input lay-reqtext="请输入出发地" id="startLocation" name="startLocation" lay-verify="required" type="text" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">目的地</label>
                    <div class="layui-input-inline">
                        <input lay-reqtext="请输入目的地" id="endLocation" name="endLocation" lay-verify="required" type="text" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
        </fieldset>
        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend>乘坐人员</legend>
            <div id="passengers" class="layui-form-item">
                <div th:each="travelpeople:${applicationMembers}">
                    <div class="layui-inline">
                        <label class="layui-form-label">姓名</label>
                        <div class="layui-input-inline">
                             <input th:value="${travelpeople.staff.name}" lay-verify="required" type="text" readonly="readonly" autocomplete="off" class="layui-input">
                         </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">身份证</label>
                        <div class="layui-input-inline">
                            <input th:value="${travelpeople.staff.card}"type="text" readonly="readonly" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">电话</label>
                        <div class="layui-input-inline">
                            <input th:value="${travelpeople.staff.phone}"type="text" readonly="readonly" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
            </div>
        </fieldset>
        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend>备注</legend>
            <div class="layui-form-item">
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label"> </label>
                    <div class="layui-input-block">
                        <textarea lay-reqtext="请输入车辆要求，例如:8座、商务车、轿车等" lay-verify="required" name="remark" placeholder="请输入内容" class="layui-textarea"></textarea>
                    </div>
                </div>
            </div>
        </fieldset>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button style="margin-left: 600px" type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>
